// Author : Adnan Hanafi
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// SocketEndPoint class
// The SocketEndPoint class is the equivalent of the sockaddr_in structure as 
// defined in the <netinet/in.h> header file. It represents an IPv4 address  
// and port number to which a socket is bound.

#include "IpAddress.h"

#ifndef SOCKETENDPOINT_H
#define	SOCKETENDPOINT_H

class SocketEndPoint
{
private:
 
   int port;
   IpAddress ipAddress;
   string endPointString;
   
   void createEndPointString();

public:
    
    static const int PORT_UNSPECIFIED = -1;
    
    SocketEndPoint();
    
    SocketEndPoint(const IpAddress & ipAddress, int port);
    
    const IpAddress & getIpAddress() const; 

    int getPort() const;
    
    void setIpAddress(const IpAddress & ipAddress);

    void setPort(int port);

    // Returns a string representing the socket endpoint in the format,
    // "ip:port"
    const string & toString() const;

};

#endif

